package org.example.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.example.pojo.entity.Order;
import org.example.pojo.entity.SaleLog;

import java.util.List;

@Mapper
public interface OrderMapper {
    @Insert("insert into webwork.order(userid,username,goodid, goodname,  num, price, saletime,addressid,address,consignee) " +
            "VALUES (#{userid},#{username},#{goodid},#{goodname},#{num},#{price},#{saletime},#{addressid},#{address},#{consignee})")
    public void insertOrder(Order order);

    @Update("update `order` set state = 1 where id = #{id} ")
    public void buyOrder(Order order);

    @Update("update `order` set state = 0 where id = #{id}")
    public void cancelOrder(Order order);

    public List<Order> list(Order order);
}
